home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / vesatp11 / example / curve.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-05-16  |  1.2 KB  |  57 lines

  1. {$X+}
  2. PROGRAM curve;
  3.  
  4.     { Draw a Bezier curve }
  5.  
  6. USES
  7.     VGraph, Crt;
  8.  
  9. CONST
  10.     lastPoint = 6;                             { highest subscript used }
  11.  
  12. VAR
  13.     pt              : Array[0..LastPoint] of PointType;
  14.     errorCode, n     : INTEGER;
  15.  
  16. PROCEDURE initPoints;
  17. BEGIN
  18.     pt [0].x := 160;   pt [0].y := 110;
  19.     pt [1].x := 160;   pt [1].y := 160;
  20.     pt [2].x :=  55;   pt [2].y := 160;
  21.     pt [3].x :=  55;   pt [3].y :=  20;
  22.     pt [4].x := 205;   pt [4].y :=  40;
  23.     pt [5].x := 190;   pt [5].y := 110;
  24.     pt [6].x := 280;   pt [6].y := 110;
  25. END;
  26.  
  27. BEGIN
  28.     InitVesa(V640x480x256);
  29.  
  30.     { Check to make sure it happened }
  31.     ErrorCode := graphResult;
  32.     IF errorCode <> grOK THEN BEGIN
  33.         WRITELN ('Graphics error ', errorCode);
  34.         WRITELN ('Program cannot run');
  35.         HALT (1);
  36.     END;
  37.  
  38.     { Draw the hull outline }
  39.     InitPoints;                                  { First initialize control points }
  40.     SetLineStyle (dottedLn, 0, normWidth);
  41.     SetColor (1);
  42.     MoveTo (pt [0].x, pt [0].y);
  43.     FOR n := 1 TO lastPoint DO
  44.         LineTo (pt [n].x, pt [n].y);
  45.  
  46.     { Now draw the curve itself }
  47.     SetLineStyle (solidLn, 0, normWidth);
  48.     SetColor (2);
  49.     DrawBezier(lastPoint,pt[1]);
  50.  
  51.     { Clean up after a keypress }
  52.     ReadKey;
  53.     CloseVesa;
  54. END.
  55.  
  56.  
  57.